package top.zuli.package01.class16;

import org.junit.Test;

import java.time.*;

public class Demo2 {
    @Test
    public void nowMethodTest(){
        //获得Instant实例对象,获得是格林尼治的当前时间,没有偏移量
        Instant instant = Instant.now();
        System.out.println(instant);
        //获得LocalDate实例，获得本地的当前年、月、日
        LocalDate localDate = LocalDate.now();
        System.out.println(localDate);
        //获得LocalTime实例，获得本地的当前时、分、秒
        LocalTime localTime = LocalTime.now();
        System.out.println(localTime);
        //获得LocalDateTime实例，获得本地的当前年、月、日、时、分、秒
        LocalDateTime localDateTime = LocalDateTime.now();
        System.out.println(localDateTime);
        //使用now方法创建ZonedDateTime实例，获得本地时区的年、月、日、时、分、秒
        ZonedDateTime zonedDateTime = ZonedDateTime.now();
        System.out.println(zonedDateTime);
    }
}

/*
public class Demo2 {
    @Test
    public void nowMethodTest(){
        Instant instant = Instant.now();
        System.out.println(instant);
        LocalDate localDate = LocalDate.now();
        System.out.println(localDate);
        LocalTime localTime = LocalTime.now();
        System.out.println(localTime);
        LocalDateTime localDateTime = LocalDateTime.now();
        System.out.println(localDateTime);
        ZonedDateTime zonedDateTime = ZonedDateTime.now();
        System.out.println(zonedDateTime);
    }
}
*/
